REpresentational State Transfer, or REST is an architectural standard for accessing and modifying resources on a server. These resources can be text, images, or data objects. REST APIs are used throughout the software industry to provide backend services to UIs or other services. Your project will use a REST API to manage the application data.
For your study of this topic, use these resources.
mvn --version javac -version java -versionNote: If maven indicates that
JAVA_HOME
needs to be defined or later it can not find a Java compiler, you need to define the environment variable JAVA_HOME
to point to the base of your installed JDK. On the SE lab machines, you can do this by selecting Start, type Accounts, User accounts -> Change my environment variables. You will have to find the latest JDK installed on the system. It will be either C:\Program Files\Java\jdk#.#.#_#
or C:\Program Files (x86)\Java\jdk#.#.#_#
. Set the JAVA_HOME
environment variable to the proper directory.pom.xml
file that describes how to build and execute the Heroes REST API.mvn compile exec:java
which first builds the application and then starts the REST API running in a local jetty web server.
{"id":11,"name":"Mr. Nice"}
and the following in your terminal as the
last line: GET /heroes/11
Run > Run Without Debugging
Environment
, choose Java
Error: Could not find or load main class com.heroes.api.heroesapi.HeroesApiApplication
Caused by: java.lang.ClassNotFoundException: com.heroes.api.heroesapi.HeroesApiApplication
CTRL+SHIFT+P
, Mac: CMD+SHIFT+P
), search for Java: Clean Java Language Server Workspace
, and run it. It will ask you if you are sure you want to clean the Java language server workspace - choose Restart and delete
.
mvn exec:exec@zip
. The resulting heroes-api.zip
file will be in the target
directory.